﻿/*
 * @author: wizardc
 */

using System.Collections.Generic;

namespace Dou.UI
{
    /// <summary>
    /// 列表数据源
    /// </summary>
    public class ListCollection<T> : ICollection
    {
        private List<T> _source;
        
        public ListCollection(List<T> source)
        {
            _source = source;
        }
        
        public List<T> source
        {
            set => _source = value;
            get => _source;
        }
        
        public int count => _source.Count;
        
        public object GetItemAt(int index)
        {
            return _source[index];
        }

        public int GetItemIndex(object item)
        {
            return _source.IndexOf((T) item);
        }
    }
}
